﻿package manager
{
    import com.greensock.*;
    import consts.*;
    import flash.display.*;
    import flash.geom.*;
    import flash.utils.*;
    import view.*;

    public class UIVisibleManager extends Object
    {
        private var Vdic:Dictionary;
        private var _allState:Boolean = true;
        private var time:Number;
        private var _unAllobj:Object;
        private static var _instance:UIVisibleManager;
        public static var VLeft:String = "left";
        public static var VRight:String = "right";
        public static var VUp:String = "up";
        public static var VDown:String = "down";
        public static var Vnull:String = "null";

        public function UIVisibleManager()
        {
            this.Vdic = new Dictionary();
            this._unAllobj = {};
            return;
        }// end function

        public function register(param1:String, param2:DisplayObject, param3:String, param4:Boolean = true) : void
        {
            if (!this.Vdic.hasOwnProperty(param1))
            {
                this.Vdic[param1] = new Object();
                this.Vdic[param1].target = param2;
                this.Vdic[param1].dir = param3;
                this.Vdic[param1].show = true;
            }
            if (param4 == false)
            {
                this._unAllobj[param1] = 1;
            }
            if (param2.x < 0 && param1 != "taskview")
            {
                this.Vdic[param1].p = new Point(0, param2.y);
            }
            else
            {
                this.Vdic[param1].p = new Point(param2.x, param2.y);
            }
            return;
        }// end function

        public function cancel(param1:String) : void
        {
            if (this.Vdic.hasOwnProperty(param1))
            {
                this.Vdic[param1] = null;
                delete this.Vdic[param1];
            }
            return;
        }// end function

        public function get allState() : Boolean
        {
            return this._allState;
        }// end function

        public function Hiddern(param1:String = "all") : void
        {
            var _loc_2:String = null;
            if (param1 == "all")
            {
                if (this._allState == true)
                {
                    GuideView.getInstance().doGuide(GuideType.GUIDE_JJAN);
                }
                this._allState = !this._allState;
                for (_loc_2 in this.Vdic)
                {
                    
                    if (this._unAllobj.hasOwnProperty(_loc_2))
                    {
                        continue;
                    }
                    this.changevisible(_loc_2);
                }
            }
            else
            {
                this.changevisible(param1, 1);
            }
            return;
        }// end function

        private function changevisible(param1:String, param2:int = 0) : void
        {
            var target:DisplayObject;
            var dir:String;
            var p:Point;
            var show:Boolean;
            var comfunc:Function;
            var name:* = param1;
            var value:* = param2;
            var vcon:* = this.Vdic[name];
            if (vcon)
            {
                target = vcon.target;
                dir = vcon.dir;
                p = vcon.p;
                if (value == 1)
                {
                    vcon.show = !vcon.show;
                    show = vcon.show;
                }
                else
                {
                    if (vcon.show == this._allState)
                    {
                        return;
                    }
                    show = this._allState;
                    vcon.show = this._allState;
                }
                if (name == "mainui")
                {
                }
                switch(dir)
                {
                    case VLeft:
                    {
                        break;
                    }
                    case VRight:
                    {
                        break;
                    }
                    case VUp:
                    {
                        break;
                    }
                    case VDown:
                    {
                        break;
                    }
                    default:
                    {
                        break;
                        break;
                    }
                }
                if (name == "mainui")
                {
                }
                switch(dir)
                {
                    case VLeft:
                    {
                        break;
                    }
                    case VRight:
                    {
                        break;
                    }
                    case VUp:
                    {
                        break;
                    }
                    case VDown:
                    {
                        break;
                    }
                    default:
                    {
                        break;
                        break;
                    }
                }
            }
            return;
        }// end function

        public static function get instance() : UIVisibleManager
        {
            var _loc_1:* = _instance || new UIVisibleManager;
            _instance = _instance || new UIVisibleManager;
            return _loc_1;
        }// end function

    }
}
